package com.sx.core;

import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

/*import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;*/

public class Log4jInit extends HttpServlet {
	public static Logger root = Logger.getRootLogger();//设置事件日志根记录器
	public static Logger ysulogger = Logger.getLogger("ysuLogger");//设置事件日志记录器
	public static Logger stdoutlogger = Logger.getLogger("stdout");//设置事件日志记录器
	
	public void init() throws ServletException
	{
	    String prefix = getServletContext().getRealPath("/");
        String file = getInitParameter("log4j-init-file");
        
        if(file !=null)
        {
        	PropertyConfigurator.configure(prefix+file);
        }
        root = Logger.getRootLogger();//设置事件日志根记录器
        ysulogger = Logger.getLogger("ysuLogger");//设置事件日志记录器
        stdoutlogger = Logger.getLogger("stdout");
	}
    public void service(ServletRequest req, ServletResponse resp) throws ServletException {
    }  
}
